﻿using ED.GRPC;

namespace ED.IService.Grpc
{
    public class GrpcClientService<T> : IGrpcClientService<T> where T : class
    {
        private readonly IGRPCExtions<T> grpcExtions;
        public GrpcClientService(IGRPCExtions<T> grpcExtions)
        {
            this.grpcExtions = grpcExtions;
        }

        /// <summary>
        /// 获取服务
        /// </summary>
        /// <param name="serviceName">远程服务名称</param>
        /// <returns></returns>
        public async Task<T> GetService(string serviceName)
        {
            T service = default(T);
                service = await grpcExtions.GetService(serviceName);              
            return service;
        }
    }
}
